﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
using System.Security.Cryptography;
using System.IO;
using System.Collections;
using System.Data;
using System.Reflection;
using System.Xml;
using System.Runtime.InteropServices;

namespace Comm.PublicClass
{
    //多语言枚举
    public enum TLanguage
    { 
        LChinese = 0,  //中文
        LEn_US = 1,    //美式英语
        LRussian = 2,  //俄语
        LJapanese = 3,  //日语
        LEgypt = 4      //埃及
    }

    //用来定义一些基类
    public class PubConsts
    {
        public class BaseMeter : IDisposable
        {
            private string meterid = string.Empty;
            private int sno = 0;
            private string meterCommAddr = string.Empty;
            private string meterNO = string.Empty;
            private string meterType = string.Empty;
            private string passWord = string.Empty;

            public string MeterName { get; set; }  //表名
            public string FPrecision { get; set; } //有功精度等级
            public string QPrecision { get; set; } //无功精度等级
            public string Voltage { get; set; }  //电压规格
            public string FCurrent { get; set; }  //电流规格
            public string Frequency { get; set; }  //频率
            public string PConstant { get; set; }  //有功脉冲常数
            public string QConstant { get; set; }  //无功脉冲常数  
            public int ConnectMode { get; set; }  //接线方式

            public string MeterID //表id 
            {
                get { return meterid; }
                set
                {
                    meterid = value;
                    SetMeterID(value);
                }
            }

            public int SNO //表位
            {
                get { return sno; }
                set
                {
                    sno = value;
                    SetMeterSNO(value);
                }
            }
            
            public string MeterCommAddr //地址  
            {
                get { return meterCommAddr; }
                set
                {
                    meterCommAddr = value;
                    SetCommAddr(value);
                }
            }
            public string MeterNO   //表号
            {
                get { return meterNO; }
                set
                {
                    meterNO = value;
                    SetMeterNO(value);
                }
            }


            public string MeterType   //表型
            {
                get { return meterType; }
                set
                {
                    meterType = value;
                    SetMeterType(value);
                }
            }
            public string PassWord  //密码
            {
                get { return passWord; }
                set
                {
                    passWord = value;
                    SetPassWord(value);
                }
            }

            public BaseMeter()
            {
                MeterName = string.Empty;
                FPrecision = string.Empty;
                QPrecision = string.Empty;
                Voltage = string.Empty;
                FCurrent = string.Empty; 
                Frequency = "50";
                PConstant = string.Empty;
                QConstant = string.Empty; 
                ConnectMode = 0;                
            }

            public void Dispose()
            {

            }

            /// <summary>
            /// 设表ID虚方法
            /// </summary>
            /// <param name="avalue"></param>
            protected virtual void SetMeterID(string avalue)
            {

            }


            /// <summary>
            /// 设表位虚方法
            /// </summary>
            /// <param name="avalue"></param>
            protected virtual void SetMeterSNO(int avalue)
            {

            }

            /// <summary>
            /// 设表地址虚方法
            /// </summary>
            /// <param name="avalue"></param>
            protected virtual void SetCommAddr(string avalue)
            {

            }

            /// <summary>
            /// 设置表号虚方法
            /// </summary>
            /// <param name="value"></param>
            protected virtual void SetMeterNO(string avalue)
            {

            }

            /// <summary>
            /// 设置表型虚方法
            /// </summary>
            /// <param name="value"></param>
            protected virtual void SetMeterType(string avalue)
            {

            }

            /// <summary>
            /// 设置表密码虚方法
            /// </summary>
            /// <param name="value"></param>
            protected virtual void SetPassWord(string avalue)
            {

            }
        }
    }
}
